package nz.ac.massey.jbuif.utils;


import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class UtilsTest {

	static Utils util;
	student s1, s2;
	
	@SuppressWarnings("static-access")
	@Before
	public void setUp() throws Exception {
		util = new Utils();
		
		s1 = new student();
		
		// set name before clone
		s1.setName("TEST CLONE");
		
		s2 = (student) util.cloneObject(s1); 
	}

	@After
	public void tearDown() throws Exception {
		util = null;
	}
	
	@Test
	public void testCloneObject1() {
		assertTrue (s1.getClass().equals(s2.getClass()));
	}
	
	
	@Test
	public void testCloneObject2() {
		assertTrue (!s1.equals(s2));
	}

	@Test
	public void testCloneObject3() {
		assertTrue (s2.getName().equals("TEST CLONE"));
	}

}



/**
 * Serializable class for test - dose nothing
 * @author ahkiouma
 *
 */
@SuppressWarnings("serial")
class student implements java.io.Serializable {
	
	String name;
	
	// setter method
	public void setName(String name){
		this.name = name;
	}

	
	// getter method
	public String getName(){
		return name;
	}
}


